<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>props</title>
    <link rel="stylesheet" type="text/css" href="./lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="./css/vue2-animate.css" type="text/css">

    <script type="text/javascript" src="./lib/vue/vue.js"></script>
    <script type="text/javascript" src="./lib/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/bootstrap/js/bootstrap.js"></script>
    <style>

    </style>

</head>

<body>
    <div id="box" class="container" style="margin-top:50px;">
        <h4>要让子组件使用父组件数据，需要在子组件中添加选项<strong style="margin-left:10px; color:red;">props</strong></h4>
        <child message="hello"></child>
    </div>
</body>


<script>
    
    var child = {
        // 选项
        template: '<h2>child {{message}}</h2>',
        props: {
            message: String
        },
    };
    
    var v = new Vue({
        el: '#box',
        components: {
            'child': child
        }

    });

</script>

</html>